<template>
  <el-cascader
    :value="value"
    style="width: 300px;"
    size="mini"
    separator="-"
    :options="options"
    :props="{label:'name',value:'id'}"
    @change="$emit('input',$event[$event.length - 1 ])"
  />
</template>

<script>
import { getDepartMentAPI } from '@/api/department'
import { list2Tree } from '@/utils'
export default {
  props: {
    value: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
      xxx: '',
      options: []
    }
  },
  async created() {
    const res = await getDepartMentAPI()
    this.options = list2Tree(res.data, 0)
  }
}
</script>

<style>

</style>
